/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.util.ArrayList;

/**
 *
 * @author pais
 */
public class User extends AnyObject{

    private String Name,LastName,eMail,Website,Phone;
    private Address address = new Address();
    private String ID,Username,Password,PasswordHint;
    private transient String rePassword;

    private boolean Locked;
    private boolean Disabled;
    private boolean Expired;

    ArrayList <Role> roles = new ArrayList<Role>();

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder()
                .append("Username: ").append(this.Username)
                .append("Enabled?: ").append(this.Disabled)
                .append("Expired?: ").append(this.Expired)
                .append("Locked?: ").append( this.Locked);

        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
   //PORQUE HACIAMOS ESTA PREGUNTA??????
        if (this==obj) return true;
   //PORQUE HACIAMOS ESTA PREGUNTA??????
        if (!(obj instanceof User)) return false;
   //CAST????     
        final User user = (User) obj;
   //EXPRESION INCOMPRENSIBLE
        return !(Username != null ? !Username.equals(user.getUsername()) : user.getUsername() != null);
    }

    @Override
    public int hashCode() {
        return(Username!=null ? Username.hashCode() : 0 );
    }

    public boolean isDisabled() {
        return Disabled;
    }

    public void setDisabled(boolean Disabled) {
        this.Disabled = Disabled;
    }

    public boolean isExpired() {
        return Expired;
    }

    public void setExpired(boolean Expired) {
        this.Expired = Expired;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public String getLastName() {
        return LastName;
    }

    public void setLastName(String LastName) {
        this.LastName = LastName;
    }

    public boolean isLocked() {
        return Locked;
    }

    public void setLocked(boolean Locked) {
        this.Locked = Locked;
    }

    public String getName() {
        return Name;
    }

    public void setName(String Name) {
        this.Name = Name;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String Password) {
        this.Password = Password;
    }

    public String getPhone() {
        return Phone;
    }

    public void setPhone(String Phone) {
        this.Phone = Phone;
    }

    public String getWebsite() {
        return Website;
    }

    public void setWebsite(String Website) {
        this.Website = Website;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public String geteMail() {
        return eMail;
    }

    public void seteMail(String eMail) {
        this.eMail = eMail;
    }

    public String getRePassword() {
        return rePassword;
    }

    public void setRePassword(String rePassword) {
        this.rePassword = rePassword;
    }

    public String getPasswordHint() {
        return PasswordHint;
    }

    public void setPasswordHint(String PasswordHint) {
        this.PasswordHint = PasswordHint;
    }

    public String getUsername() {
        return Username;
    }

    public void setUsername(String Username) {
        this.Username = Username;
    }

    public void addRole(Role r) {
        roles.add(r);
    }


}
